package love.yuanmengrobot.thousandlanguagegarden.bus.service.impl;

import love.yuanmengrobot.thousandlanguagegarden.bus.entity.BookReviews;
import love.yuanmengrobot.thousandlanguagegarden.bus.dao.BookReviewsDao;
import love.yuanmengrobot.thousandlanguagegarden.bus.service.BookReviewsService;
import love.yuanmengrobot.zframe.ioc.annotation.Resource;
import java.util.List;

/**
 * 书籍评论(BookReviews)表服务实现类
 *
 * @author makejava
 * @since 2021-07-13 14:28:13
 */

public class BookReviewsServiceImpl implements BookReviewsService {
    @Resource
      BookReviewsDao bookReviewsDao;

    /**
     * 通过ID查询单条数据
     *
     * @param objectid 主键
     * @return 实例对象
     */
    @Override
    public BookReviews queryById(String objectid) {
        return this.bookReviewsDao.queryById(objectid);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<BookReviews> queryAllByLimit(int offset, int limit) {
        return this.bookReviewsDao.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param bookReviews 实例对象
     * @return 实例对象
     */
    @Override
    public BookReviews insert(BookReviews bookReviews) {
        this.bookReviewsDao.insert(bookReviews);
        return bookReviews;
    }

    /**
     * 修改数据
     *
     * @param bookReviews 实例对象
     * @return 实例对象
     */
    @Override
    public BookReviews update(BookReviews bookReviews) {
        this.bookReviewsDao.update(bookReviews);
        return this.queryById(bookReviews.getObjectid());
    }

    /**
     * 通过主键删除数据
     *
     * @param objectid 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(String objectid) {
        return this.bookReviewsDao.deleteById(objectid) > 0;
    }
}
